<%@ page language="java" contentType="text/html; charset=GBK"
    pageEncoding="GBK"%>
<jsp:directive.page import="db.DBHander"/>
<%
	
	String userName = "";
	String role ="";
	if(session.getAttribute("userName")!=null &&session.getAttribute("role")!=null) {
		userName =(String) session.getAttribute("userName");
		role=  (String)session.getAttribute("role");
		
	}
	if(role.compareTo("admin")!=0){
		response.sendRedirect("login.jsp");
		System.out.println("pageValidate.jsp not admin");	
	}
%>     
    
<%



    String newsid = request.getParameter("newsid");
	String date = request.getParameter("date");
	String title = request.getParameter("title");
	String content =request.getParameter("content");
	

	
	
	DBHander db = new DBHander();
	String sql = "update newses set showdate='"+ date+ "' ,title='" + title	+ "',content='"+
	content+"' where id="+newsid;
	
	db.stmt.executeUpdate(sql);
	db.releaseAll();

	
	
	response.sendRedirect("newsAdmin.jsp?id="+newsid);


	

%>    
